package cn.jobstart.controller;
import cn.jobstart.es.service.IResumeEsService;
import cn.jobstart.web.common.SkJsonResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RestController;
import cn.jobstart.pubInter.exception.SkException;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.RestfulController;
import cn.jobstart.dto.ResumeCertificateDTO;
import cn.jobstart.dto.ResumeCertificatePageDTO;
import cn.jobstart.modelExt.ResumeCertificateExt;
import cn.jobstart.searchExt.ResumeCertificateSearchExt;
import cn.jobstart.service.IResumeCertificateService;
import cn.jobstart.vo.ResumeCertificateDetailVO;
import cn.jobstart.vo.ResumeCertificateListVO;
import cn.jobstart.vo.ResumeCertificateDomainVO;
import cn.jobstart.vo.ResumeCertificateDetailDomainVO;
import cn.jobstart.export.ResumeCertificateDomainExport;
import cn.jobstart.controller.ApiManageController;
import org.springframework.validation.annotation.Validated;
import java.util.Set;
import java.util.HashSet;
import cn.jobstart.pubInter.exception.BusinessException;

/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description ResumeCertificateController      证书
*/
@Api(tags = "人才管理系统-证书相关", description = "证书相关接口")
@RestController(value ="resumeCertificateRestfulController")
@RequestMapping("/resumeCertificate/")
@Validated
public class ResumeCertificateController extends ApiManageController<ResumeCertificateDTO,ResumeCertificatePageDTO,ResumeCertificateExt, ResumeCertificateSearchExt,ResumeCertificateDomainVO,ResumeCertificateDetailDomainVO,ResumeCertificateDetailVO,ResumeCertificateListVO,String> {

	@Resource(name = "resumeCertificateService")
	private IResumeCertificateService resumeCertificateService;



	@Resource
	private IResumeEsService resumeEsService;


	@Override
	public void afterPostAdd(ResumeCertificateDTO dto, ResumeCertificateExt domain, ResumeCertificateDetailVO resumeCertificateDetailVO, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostAdd(dto, domain, resumeCertificateDetailVO, request, session);
		resumeEsService.publishResumeCertificateByResumeId(domain.getResumesId());
	}

	@Override
	public void afterPostMod(ResumeCertificateDTO dto, ResumeCertificateExt domain, SkJsonResult<ResumeCertificateDetailVO> jsonResult, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostMod(dto, domain, jsonResult, request, session);
		resumeEsService.publishResumeCertificateByResumeId(domain.getResumesId());
	}

	@Override
	public IBaseService<ResumeCertificateExt, ResumeCertificateSearchExt,String> getBaseService() throws SkException {
		return resumeCertificateService;
	}

	@Override
	public String getBaseRoute() {
		return "/resumeCertificate/";
	}

	/**
	* 当前模板名称
	* @return
	*/
	@Override
	public String getModelName(){
		return "证书";
	}

	@Override
	public Class exportExcelClass() {
		return ResumeCertificateDomainExport.class;
	}

	@Override
	public Set<String> totalMapSet() {
		Set totalMapSet=new HashSet();
		totalMapSet.add("count(resume_certificate.rc_id) as countNum");
		return totalMapSet;
	}


}